home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 2 / Gold Medal Software Volume 2 (Gold Medal) (1994).iso / os2 / cenvi2.arj / WINDOWS.CMD < prev    next >
OS/2 REXX Batch file  |  1993-12-21  |  5KB  |  114 lines

  1. EXTPROC CEnvi
  2. /****************************************************************
  3.  *** FullWin - An examples of the WinCreateObject function to ***
  4.  ***           create a full-screen Windows session.  You may ***
  5.  ***           want to edit the settings in this file to suit ***
  6.  ***           your OS/2 setup and configurations.            ***
  7.  ****************************************************************/
  8.  
  9. #include <PMdll.lib>
  10. #include <Switch,cmd,,EXTPROC> // Switch routine
  11.  
  12. #define  DEFAULT_EXECUTABLE   "ProgMan.exe"
  13. SetupString = ""; // initialize to contain nothing
  14.  
  15. main(argc,argv)
  16. {
  17.    if ( 2 == argc  &&  !strcmp("/?",argv[1]) )
  18.       Instructions();
  19.    else {
  20.       // Set as a full-screen windows session
  21.       Setup("PROGTYPE=WIN");
  22.       // Setup("PROGTYPE=WINDOWEDWIN");
  23.       // Setup("PROGTYPE=PROG_31_ENH");
  24.       // Setup("PROGTYPE=PROG_31_ENHSEAMLESSVDM);
  25.       // Setup("PROGTYPE=PROG_31_ENHSEAMLESSCOMMON);
  26.       // Tell to open immediately
  27.       Setup("OPEN=DEFAULT");
  28.       // add input paramters to setup string.  If first argument then that
  29.       // is the program to start, else default.
  30.       Executable = ( argc < 2 ) ? DEFAULT_EXECUTABLE : argv[1] ;
  31.       Setup("EXENAME",Executable);
  32.       // add the root of this executable into the title
  33.       sprintf(Title,SplitFileName(Executable).name);
  34.       // if more than one argument, then make those the parameters
  35.       if ( argc < 3 )
  36.          Parameters = NULL;
  37.       else {
  38.          Parameters = "";
  39.          for ( i = 2; i < argc; i++ ) {
  40.             if ( i != 2 ) strcat(Parameters," ");
  41.             strcat(Parameters,argv[i]);
  42.             // add root of this parameter to the title
  43.             sprintf(Title,"%s %s",Title,SplitFileName(argv[i]).name);
  44.          }
  45.          Setup("PARAMETERS",Parameters);
  46.       }
  47.       // Set specific dos parameters
  48.       SetDosSessionParameters();
  49.       // finally, create object and switch to it
  50.       handle = WinCreateObject("WPProgram",Title,SetupString,"<WP_NOWHERE>",CO_REPLACEIFEXISTS);
  51.       if ( handle == NULL )
  52.          printf("\a\a\aUnable to create the Windows object.\n"), exit(1);
  53.       // call switch.cmd CEnvi function to bring this program to the foreground
  54.       SwitchToName(Title);
  55.    }
  56. }
  57.  
  58. SetDosSessionParameters()  // add any specific DOS session setttings.  These are the
  59. {                          // Settings I like.  YOU may change them.
  60.  //Setup("SET DOS_DEVICE=")
  61.  //Setup("SET DOS_FCBS=2")
  62.  //Setup("SET DOS_FCBS_KEEP=2")
  63.    Setup("SET DOS_FILES=55")
  64.  //Setup("SET DOS_HIGH=0")
  65.  //Setup("SET DOS_UMB=0")
  66.  //Setup("SET DPMI_DOS_API=ENABLED")
  67.  //Setup("SET DPMI_MEMORY_LIMIT=3")
  68.  //Setup("SET DPMI_NETWORK_BUFF_SIZE=1")
  69.    Setup("SET IDLE_SECONDS=8")
  70.    Setup("SET IDLE_SENSITIVITY=85")
  71.  //Setup("SET EMS_FRAME_LOCATION=NONE")
  72.  //Setup("SET EMS_HIGH_OS_MAP_REGION=0")
  73.  //Setup("SET EMS_LOW_OS_MAP_REGION=0")
  74.  //Setup("SET EMS_MEMORY_LIMIT=0")
  75.  //Setup("SET VIDEO_8514A_XGA_IOTRAP=0")
  76.  //Setup("SET VIDEO_SWITCH_NOTIFICATION=1")
  77.  //Setup("SET XMS_HANDLES=0")
  78.  //Setup("SET XMS_MEMORY_LIMIT=0")
  79.  //Setup("SET XMS_MINIMUM_HMA=0")
  80. }
  81.  
  82. Setup(Key,Value) // if one parameter then just append this string.  If two then
  83. {                // it is key,value, so must make key=value
  84.    strcat(SetupString,Key);
  85.    if ( va_arg() == 2 )
  86.       strcat(strcat(SetupString,"="),Value);
  87.    strcat(SetupString,";");
  88. }
  89.  
  90. Instructions()
  91. {
  92.    printf("\n")
  93.    printf("Windows - Start a full-screen windows session with optional parameters.  The\n")
  94.    printf("          particular settings for you system can be altered by editing this\n")
  95.    printf("          Windows.cmd file.\n")
  96.    printf("\n")
  97.    printf("SYNTAX: Windows [Program [Parameters...]]\n")
  98.    printf("\n")
  99.    printf("Where: Program     - A windows executable; defaults to %s\n",DEFAULT_EXECUTABLE)
  100.    printf("       Parameters  - Parameters passed to the Executable\n")
  101.    printf("\n")
  102.    printf("Examples: The following example assume Windows.cmd and ProgMan.exe are in the\n")
  103.    printf("          PATH, and that AmiPro.exe is not in the PATH.\n")
  104.    printf("\n")
  105.    printf("   Windows\n")
  106.    printf("   Windows ProgMan.exe\n")
  107.    printf("   Windows ProgMan.exe C:\\Utl\\AmiPro\\AmiPro.exe\n")
  108.    printf("   Windows ProgMan.exe C:\\Utl\\AmiPro\\AmiPro.exe C:\\DOCS\\MANUAL.SAM\n")
  109.    printf("   Windows C:\\Utl\\AmiPro\\AmiPro.exe\n")
  110.    printf("   Windows C:\\Utl\\AmiPro\\AmiPro.exe C:\\DOCS\\MANUAL.SAM\n")
  111.    printf("\n")
  112. }
  113.  
  114.